package Top_Interview_Questions.Math;

/**
 * @Author: 吕庆龙
 * @Date: 2020/3/10 20:42
 * <p>
 * 功能描述:
 */
public class _0326 {

    //循环迭代
    public boolean isPowerOfThree(int n) {
        if (n < 1) {
            return false;
        }

        while (n % 3 == 0) {
            n /= 3;
        }

        return n == 1;
    }

}
